package com.molei.testspi;

import com.molei.spi.PrintInterface;

import java.util.Iterator;
import java.util.ServiceLoader;

/**
 * @author 莫磊
 * @since 2024-02-21
 */
// @SpringBootApplication
public class SPIApplication {
    public static void main(String[] args) {
        ServiceLoader<PrintInterface> printInterfaces = ServiceLoader.load(PrintInterface.class);
        Iterator<PrintInterface> iterator = printInterfaces.iterator();
        while (iterator.hasNext()) {
            PrintInterface next = iterator.next();
            next.print();
        }
        for (PrintInterface printInterface : printInterfaces) {
            printInterface.print();
        }
        // SpringApplication.run(SPIApplication.class, args);
    }
}
